fix(opensearch): make shadow write log level configurable (#35302)#35375
fix(opensearch): make shadow write log level configurable (#35302)#35375fabrizzio-dotCMS wants to merge 4 commits intomainfrom
Conversation
…e-and-forget tests (#35302) Introduces DOTCMS_SHADOW_WRITE_LOG_LEVEL (default WARN) so operators can raise shadow OS write failures to ERROR during QA or lower them to DEBUG during steady-state migration, without code changes. Adds PhaseRouterTest covering all four migration phases with the mismatched-index-name scenario. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Claude finished @fabrizzio-dotCMS's task in 2m 58s —— View job PR Review
Findings1. case "INFO": Logger.info(clazz, message); break; // t is silently dropped
Either document this in the Javadoc explicitly, or include the exception message inline: case "INFO": Logger.info(clazz, t != null ? message + " — " + t.getMessage() : message); break;2. boolean primaryResult = true; // sentinel: optimistic defaultThe default value 3. No test coverage for the log-level dispatch itself
4. Config re-read on every final String level = Config.getStringProperty(SHADOW_WRITE_LOG_LEVEL_KEY, "WARN").toUpperCase();In a bulk-processor failure storm (e.g., OS unavailable during a full reindex), this method could be called thousands of times per batch. 5. this.queueApi = null; // not needed for the methods under testIf a future test exercises a path that calls 6. TOCTOU on phase reads (pre-existing, but amplified by this PR) Several methods call Summary: The |
…entletIndexAPIImpl Adds ContentletIndexAPIImplPhaseTest (unit, full mock injection) and ContentletIndexAPIImplMigrationIT (integration, requires two real clusters) covering deactivateIndex, createContentIndex, closeIndex, and activateIndex across all four migration phases. Includes a full-dependency constructor on ContentletIndexAPIImpl for isolated unit testing without APILocator. Registers ContentletIndexAPIImplMigrationIT in OpenSearchUpgradeSuite. Refs: #35302 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ContentIndex addCustomMapping was called unconditionally after a failed index creation, which could apply mappings to a non-existent index and surface an unrelated exception instead of the clean false-return the soft-failure contract promises. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
DOTCMS_SHADOW_WRITE_LOG_LEVELconfig property (defaultWARN) so operators can tune the visibility of OS shadow write failures in dual-write phases without code changesPhaseRouter×3,BulkProcessorListener×2,ContentletIndexAPIImpl×1) to the new centralisedIndexConfigHelper.logShadowWriteFailure()helperPhaseRouterTestwith 12 unit tests covering the mismatched-index-name scenario (ES hasworking_T0, OS hasworking_T1) across all four migration phasesUsage
Test plan
./mvnw test -pl :dotcms-core -Dtest=PhaseRouterTest— 12/12 pass./mvnw compile -pl :dotcms-core -DskipTests— compiles cleanDOTCMS_SHADOW_WRITE_LOG_LEVEL=ERROR, trigger a Phase 1 shadow write failure, confirm ERROR appears in logsDOTCMS_SHADOW_WRITE_LOG_LEVEL=DEBUG, confirm shadow failures are silent at WARN levelCloses #35302
🤖 Generated with Claude Code